import request from '@/utils/request'

/**
 * 获取精选题库列表
 * @returns 精选题库列表
 */
export const getStarQuestionListAPI = (data) => {
  return request({
    url: `questions/choice`,
    params: data
  })
}

/**
 * 精选题库移出
 * @param {String} id
 * @param {Number} choiceState
 * @returns
 */
export const startQuestionsChoseAPI = (id, choiceState) => {
  return request({
    url: `/questions/choice/${id}/${choiceState}`,
    method: 'PATCH'
  })
}

/**
 * 题库上架
 * @param {String} id 题目id
 * @param {Number} publishState 题目状态
 * @returns 题目状态
 */
export const resetPublishStateAPI = (id, publishState) => {
  return request({
    url: `/questions/choice/${id}/${publishState}`,
    method: 'POST'
  })
}

/**
 * 试题审核
 * @param {Object} data 试题信息
 * @returns 审核结果
 */
export const resetQuestionCheckAPI = (data) => {
  return request({
    url: `/questions/check/${data.id}`,
    data,
    method: 'POST'
  })
}
